package sk.vasicek.drinkagent.domain;

import java.util.Date;

public class CustomDrink {
	public static final String ALCOHOL_CONCENTRATION = "custom_drink_concentration";
	public static final String VOLUME = "custom_drink_volume";
	public static final String DRINK_NAME = "custom_drink_name";
	public static final String DRINK_NOTE = "custom_drink_note";
	public static final String DRINK_ID = "custom_drink_id";
	public static final String DRINK_PRICE = "custom_drink_price";
	public static final String DRINK_CREATED = "custom_drink_time";

	private Integer id;
	private double concentration = 0d;
	private double volume = 0d;
	private double price = 0d;
	private Date timeCreated;
	private String name = "";
	private String[] nameLocalized = {};
	private String note = "";

	public CustomDrink(double latitude, double longitude) {
		this.concentration = latitude;
		this.volume = longitude;
	}

	public CustomDrink(double concentration, double volume, String name, String note) {
		this.concentration = concentration;
		this.volume = volume;
		this.name = name;
		this.note = note;
	}

	public CustomDrink(double concentration, double volume, String name, String[] names, String note) {
		this.concentration = concentration;
		this.volume = volume;
		this.nameLocalized = names;
		// for (String name : names) {
		// this.name += name + ":";
		// }
		// if (this.name.endsWith(":"))
		// this.name = this.name.substring(0, this.name.length() - 1);
		this.name = name;
		this.note = note;
		this.timeCreated = new Date();
	}

	public CustomDrink(Integer id, double concentration, double volume, String name, String note, double price, Date timeCreated) {
		this.id = id;
		this.concentration = concentration;
		this.volume = volume;
		this.name = name;
		this.note = note;
		this.price = price;
		this.timeCreated = timeCreated;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public String getNameLocalized(MyLocale locale) {
		// nameLocalized = name.split(":");
		// switch (locale) {
		// case en:
		// if (nameLocalized.length > 0)
		// return nameLocalized[MyLocale.en.getLocaleCode()];
		// case sk:
		// if (nameLocalized.length > 1)
		// return nameLocalized[MyLocale.sk.getLocaleCode()];
		// case cz:
		// if (nameLocalized.length > 2)
		// return nameLocalized[MyLocale.cz.getLocaleCode()];
		// default:
		// if (nameLocalized.length > 0)
		// return nameLocalized[MyLocale.en.getLocaleCode()];
		// else
		//
		// return name;
		//
		// }
		if (nameLocalized.length >= 3)
			return nameLocalized[MyLocale.en.getLocaleCode()];
		else
			return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public double getConcentration() {
		return concentration;
	}

	public void setConcentration(double concentration) {
		this.concentration = concentration;
	}

	public double getVolume() {
		return volume;
	}

	public void setVolume(double volume) {
		this.volume = volume;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public Date getTimeCreated() {
		return timeCreated;
	}

	public void setTimeCreated(Date timeCreated) {
		this.timeCreated = timeCreated;
	}
}
